package com.ding.demo.jvm;


/**
 * VM Args： -Xss2M
 */

public class StackLeakByThreadTest {


    private void dontStop() {
        while(true) {
        }
    }

    public void stackLeakByThread() {
        while(true) {
            Thread thread=new Thread(new Runnable() {
                @Override
                public void run() {
                    dontStop() ;
                } }
     ) ;
            thread.start() ;
        } }

        //谨慎测试 容易死机
    public static void main(String[] args)  throws Throwable{



       /* StackLeakByThreadTest oom=new StackLeakByThreadTest() ;
        oom.stackLeakByThread() ;*/
    }
}
